#region using
using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.Data;
using BLToolkit.Mapping;
using BLToolkit.Data;
using BLToolkit.DataAccess;
using BLToolkit.EditableObjects;
using BLToolkit.Reflection;
#endregion

namespace Brainsoft.Core.BusinessLogic
{

    public abstract class Users : EditableObject
    {
        [PrimaryKey()]
        public abstract int IdUsuario { get; set; }
        public abstract string Password { get; set; }                
        public abstract string Email { get; set; }
        public abstract string PreguntaPassword { get; set; }
        public abstract string RespuestaPassword { get; set; }
        public abstract string Nombre1 { get; set; }
        public abstract string Nombre2 { get; set; }
        public abstract string Apellido1 { get; set; }
        public abstract string Apellido2 { get; set; }
        public abstract bool Vigente { get; set; }
        public abstract DateTime FechaIngreso { get; set; }
        public abstract DateTime FechaUltimoLogin { get; set; }
        public abstract DateTime FechaUltimoCambioPassword { get; set; }
        public abstract DateTime FechaUltimoBloqueo { get; set; }
        public abstract short IntentosPasswordFallidos { get; set; }
        public abstract string rut_dv { get; set; }
        [MapIgnore()]
        public string Nombres
        {
            get
            {
                return String.Format("{0} {1}", Nombre1, Nombre2);
            }            
        }
        [MapIgnore()]
        public string Rut
        {
            get
            {
                return String.Format("{0}-{1}", IdUsuario.ToString(), rut_dv);
            }
        }

        public static Users CreateInstance()
        {
            return TypeAccessor<Users>.CreateInstanceEx();
        }
    }

    public abstract class UsersDataAccessor : AccessorBase<Users, UsersDataAccessor>
    {
        public abstract DataTable SelectByName(string nombre1, string paterno, string materno);
    }

}
